package com.Servlet;

import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.function.Function;

/**
 * Servlet implementation class searchByBorrowBook
 */
@WebServlet("/searchByBorrowBook")
public class searchByBorrowBook extends HttpServlet {
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			request.setCharacterEncoding("utf-8");
			response.setContentType("utf-8");
			response.setCharacterEncoding("utf-8");
			String userSno = request.getParameter("userSno");
			String[] searchInfo = request.getParameterValues("serchInfo");
			ResultSet rs = null;
			rs = Function.multiQuery(searchInfo);
			request.setAttribute("userSno", userSno);
			request.setAttribute("ResultSet", rs);
			request.setAttribute("flag", "SearchByBorrowBook");
			request.getRequestDispatcher("Main.jsp").forward(request, response);
		} catch (ClassNotFoundException | SQLException e) {
			e.printStackTrace();
		}
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
